import {defineStore} from 'pinia';

export const userStore = defineStore('userStore', {

    state: () => ({
        userId : "",
        userName: "",
        userRole: "",
        userIsLogin: false
    }),

    getters: {},

    actions: {
        login(userId: string, userName: string, role: string) {
            this.userId = userId;
            this.userName = userName;
            this.userRole = role;
            this.userIsLogin = true;
        },
        logout() {
            this.userId = null;
            this.userName = null;
            this.userRole = null;
            this.userIsLogin = false;
        }
    },
});
